package jd;

import jd.Issue;

/*
	CREATE TABLE journal (
		id	VARCHAR PRIMARY KEY,
		country	VARCHAR,
		issn	VARCHAR,
		title	VARCHAR,
		volume	VARCHAR,
		issue	VARCHAR
	);
*/

public class Journal {
	public String id;
	public String country;
	public String issn;
	public String title;
	public Issue journal_issue;

	public void out_sql() {
		String volume, issue;
		issue = "";
		if (journal_issue != null && journal_issue.issue !=null)
			issue = journal_issue.issue;
		volume = "";
		if (journal_issue != null && journal_issue.volume !=null)
			volume = journal_issue.volume;
		System.out.printf("INSERT INTO journal (id, country, issn, " +
			"title, volume, issue) VALUES " + 
			"('%s', '%s', '%s', '%s', '%s', '%s') " + 
			"ON CONFLICT DO NOTHING;\n",
			id.replaceAll("'", "''"), country.replaceAll("'", "''"),
			issn.replaceAll("'", "''"), title.replaceAll("'", "''"),
			volume.replaceAll("'", "''"), issue.replaceAll("'", "''"));
	}
}

